package com.wondertek.poms.core.filter.impl;

import com.wondertek.poms.core.filter.BaseRuleFilter;
import com.wondertek.poms.core.filter.RuleFilterChain;
import org.apache.commons.lang3.StringUtils;

import com.wondertek.poms.dao.po.Content;
import com.wondertek.poms.dao.po.IRulePo;
import com.wondertek.poms.dao.po.PrdInfoRule;


/**
 * <p><b>CopyRightAreaFilter Description:</b> 版权最优过滤器</p>
 * @author douzi
 * <b>DATE</b> 2019年9月27日 下午4:45:27
 */
public class CopyRightOptimalFilter extends BaseRuleFilter {

	@Override
	public void doFilter(IRulePo rule, Content c, RuleFilterChain chain) {
		if (rule instanceof PrdInfoRule) {
			PrdInfoRule r = (PrdInfoRule) rule;
			this.process(r.getPrdRuleId(), 
					r.getOptimal() == null ? null : r.getOptimal() + "", 
					c.getOptimal(), 
					chain, 
					"版权最优-Optimal", 
					c);
		}
		
		chain.doFilter(rule, c, chain);
	}
	
	void process(Long id, String ruleStr, String voStr, RuleFilterChain chain, String comments, Content c) {
        if (StringUtils.isNotBlank(c.getCopyrightType()) && c.getCopyrightType().equals("1")) {//弱版权不需判断最优版权
        	this.baseFilter(id, ruleStr, voStr, chain, comments);
        }
    }
}
